class Shared {
    /**
     * 获取 Token
     */
    getters = {
        getToken: localStorage.getItem("token") || "" // 子应用独立运行时，在 localStorage 中获取 token
    }
    mutations = {
        setToken: (token) => {
            localStorage.setItem("token", token);// 子应用独立运行时，在 localStorage 中获取 token
        }
    }

}

class SharedModule {
    static shared = new Shared();
    /**
     * 重载 shared
     */
    static overloadShared(shared) {
        SharedModule.shared = shared;
    }

    /**
     * 获取 shared 实例
     */
    static getShared() {
        return SharedModule.shared;
    }
}

export default SharedModule;